home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / gameboy / gb.h < prev    next >
C/C++ Source or Header  |  1995-12-30  |  6KB  |  137 lines

  1. /** VGB: portable GameBoy emulator ***************************/
  2. /**                                                         **/
  3. /**                           GB.h                          **/
  4. /**                                                         **/
  5. /** This file contains definitions for the GameBoy hardware **/
  6. /** emulation.                                              **/
  7. /**                                                         **/
  8. /** Copyright (C) Marat Fayzullin 1995                      **/
  9. /**     You are not allowed to distribute this software     **/
  10. /**     commercially. Please, notify me, if you make any    **/   
  11. /**     changes to this file.                               **/
  12. /*************************************************************/
  13.  
  14. /* Amiga includes */
  15. #include <proto/exec.h>
  16. #include <proto/dos.h>
  17. #include <proto/intuition.h>
  18. #include <proto/graphics.h>
  19. #include <proto/asl.h>
  20. #include <dos/rdargs.h>
  21. #include <exec/memory.h>
  22.  
  23.  
  24. #include "Z80.h"
  25.  
  26.  
  27. #define NORAM     0xFF
  28. #define MAXCHEAT  256
  29.  
  30. #define VBL_IFLAG 0x01
  31. #define LCD_IFLAG 0x02
  32. #define TIM_IFLAG 0x04
  33. #define SIO_IFLAG 0x08
  34. #define JOY_IFLAG 0x10
  35.  
  36. #define JOYPAD  RAM[0xFF00] /* Joystick: 1.1.P15.P14.P13.P12.P11.P10      */
  37. #define SIODATA RAM[0xFF01] /* Serial IO data buffer                      */
  38. #define SIOCONT RAM[0xFF02] /* Serial IO control register                 */
  39. #define DIVREG  RAM[0xFF04] /* Divider register (???)                     */
  40. #define TIMECNT RAM[0xFF05] /* Timer counter. Gen. int. when it overflows */
  41. #define TIMEMOD RAM[0xFF06] /* New value of TimeCount after it overflows  */
  42. #define TIMEFRQ RAM[0xFF07] /* Timer frequency and start/stop switch      */
  43. #define IFLAGS  RAM[0xFF0F] /* Interrupt flags: 0.0.0.JST.SIO.TIM.LCD.VBL */
  44. #define ISWITCH RAM[0xFFFF] /* Switches to enable/disable interrupts      */
  45. #define LCDCONT RAM[0xFF40] /* LCD control register                       */
  46. #define LCDSTAT RAM[0xFF41] /* LCD status register                        */
  47. #define SCROLLY RAM[0xFF42] /* Starting Y position of the background      */
  48. #define SCROLLX RAM[0xFF43] /* Starting X position of the background      */
  49. #define CURLINE RAM[0xFF44] /* Current screen line being scanned          */
  50. #define CMPLINE RAM[0xFF45] /* Gen. int. when scan reaches this line      */
  51. #define BGRDPAL RAM[0xFF47] /* Background palette                         */
  52. #define SPR0PAL RAM[0xFF48] /* Sprite palette #0                          */
  53. #define SPR1PAL RAM[0xFF49] /* Sprite palette #1                          */
  54. #define WNDPOSY RAM[0xFF4A] /* Window Y position                          */
  55. #define WNDPOSX RAM[0xFF4B] /* Window X position                          */
  56.  
  57.  
  58. extern byte Verbose;          /* Verboseness level                          */
  59.  
  60. extern byte *RAM;             /* Pointer to Z80 address space (64kB)        */
  61.  
  62. extern int  UPeriod;          /* Number of VBlanks per screen update        */
  63. extern int  VPeriod;          /* Number of Z80 cycles between VBlanks       */
  64.  
  65. extern byte LineDelay;        /* When 1, CMPLINE interrupts are delayed     */
  66.  
  67. extern int  ROMBanks;         /* Total number of ROM banks                  */ 
  68. extern int  RAMBanks;         /* Total number of RAM banks                  */
  69.  
  70. extern byte BPal[4];          /* Background palette                         */
  71. extern byte SPal0[4],SPal1[4];/* Sprite palettes                            */
  72.  
  73. extern byte *ChrGen;          /* Character generator                        */
  74. extern byte *BgdTab,*WndTab;  /* Background and window character tables     */
  75.  
  76.  
  77. void M_WRMEM(word A,byte V);
  78.  
  79.  
  80. /****************************************************************/
  81. /*** Initialize and start GameBoy emulation. This function    ***/
  82. /*** returns 0 in the case of failure.                        ***/
  83. /****************************************************************/
  84. int StartGB(char *CartName);
  85.  
  86. /****************************************************************/
  87. /*** Free resources allocated by StartGB().                   ***/
  88. /****************************************************************/
  89. void TrashGB(void);
  90.  
  91. /****************************************************************/
  92. /*** Add a cheat to the cheat list [call before StartGB()].   ***/
  93. /****************************************************************/
  94. int AddCheat(char *Cheat);
  95.  
  96. /****************************************************************/
  97. /*** Allocate resources needed by the machine-dependent code. ***/
  98. /************************************** TO BE WRITTEN BY USER ***/
  99. int InitMachine(void);
  100.  
  101. /****************************************************************/
  102. /*** Deallocate all resources taken by InitMachine().         ***/
  103. /************************************** TO BE WRITTEN BY USER ***/
  104. void TrashMachine(void);
  105.  
  106. /****************************************************************/
  107. /*** Refresh screen.                                          ***/
  108. /************************************** TO BE WRITTEN BY USER ***/
  109. void RefreshScreen(void);
  110.  
  111. /****************************************************************/
  112. /*** Refresh line Y [0-143].                                  ***/
  113. /************************************** TO BE WRITTEN BY USER ***/
  114. void RefreshLine(byte Y);
  115.  
  116. /****************************************************************/
  117. /*** Refresh sprites.                                         ***/
  118. /************************************** TO BE WRITTEN BY USER ***/
  119. void RefreshSprites(void);
  120.  
  121. /****************************************************************/
  122. /*** Get joystick state: START.SELECT.B.A.D.U.L.R.            ***/
  123. /************************************** TO BE WRITTEN BY USER ***/
  124. byte Joystick(void);
  125.  
  126. /****************************************************************/
  127. /*** Amiga specific functions and defines                     ***/
  128. /************************************** TO BE WRITTEN BY USER ***/
  129. void AllocatePens(void);
  130. STRPTR ReqFile(void);
  131.  
  132. #define OPT_VERBOSE ((ULONG*)(ArgPtrs[0]))
  133. #define OPT_VPER ((ULONG*)(ArgPtrs[1]))
  134. #define OPT_UPER ((ULONG*)(ArgPtrs[2]))
  135. #define OPT_TRAP ((STRPTR)(ArgPtrs[3]))
  136. #define OPT_HELP ((BOOL)(ArgPtrs[4]))
  137.